/////////////////////////////////////////////
// AcTransactionReactor reactors.

#include "StdAfx.h"
#include "StdArx.h"


CMATransReact::CMATransReact(const bool storeInDocVars, AcApDocument* pDoc)
{
	if (storeInDocVars) {

		assert(DocVars.docData(pDoc).m_pCMATransReact == NULL);

		m_pDoc = pDoc;
		m_pDoc->transactionManager()->addReactor(this);
		DocVars.docData(m_pDoc).m_pCMATransReact = this;

	} else
		m_pDoc = NULL;
}

CMATransReact::~CMATransReact()
{
	if (m_pDoc) {
		if (DocVars.docData(m_pDoc).m_pCMATransReact)
			DocVars.docData(m_pDoc).m_pCMATransReact = NULL;
		
		m_pDoc->transactionManager()->removeReactor(this);
		m_pDoc = NULL;
	}
}

void CMATransReact::transactionStarted(int& numTransactions)
{
	acutPrintf( "\n---- Reactor: transactionStarted");
	acutPrintf("\nTransaction level = %d ", numTransactions);
}

void CMATransReact::transactionEnded(int& numTransactions)
{
	acutPrintf( "\n---- Reactor: transactionEnded");
}

void CMATransReact::transactionAborted(int& numTransactions)
{
	acutPrintf( "\n---- Reactor: transactionAborted");
}

void CMATransReact::endCalledOnOutermostTransaction(int& numTransactions)
{
	acutPrintf( "\n---- Reactor: endCalledOnOutermostTransaction");
}

